﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace NetDiskPRJ.BLL
{
    public class Apscatcol
    {
        public Apscatcol()
        {
 
        }

        /// <summary>
        /// 获得数据列表
        ///<creator>zhongyl</creator>
        /// <date>2012-02-21</date>
        /// </summary>
        public List<NetDiskPRJ.Model.Apscatcol> GetListds()
        {
            DAL.Apscatcol ApscatcolDAL = new DAL.Apscatcol();
            return DataTableToList(ApscatcolDAL.GetListds().Tables[0]);
        }

        
        /// <summary>
        /// 获取该表需要记录的字段名
        /// <creator>zhongyl</creator>
        /// <date>2013-2-23</date>
        /// </summary>
        /// <param name="aps_tnam"></param>
        /// <returns></returns>
        public List<NetDiskPRJ.Model.Apscatcol> GetTrackColumn(string aps_tnam)
        {
            DAL.Apscatcol ApscatcolDAL = new DAL.Apscatcol();
            return DataTableToList(ApscatcolDAL.GetTrackColumn(aps_tnam));
        }

                /// <summary>
        /// 更新数据表,根据增删改三个列表
        /// </summary>
        /// <param name="cdVisitTypeModelAddList"></param>
        /// <param name="cdVisitTypeModelDeleteList"></param>
        /// <param name="cdVisitTypeModelUpdateList"></param>
        public void UpdateByModelList(List<Model.Apscatcol> ModelUpdateList)
        {

            DAL.Apscatcol apscatcolDAL = new DAL.Apscatcol();
            apscatcolDAL.UpdateByModelList(ModelUpdateList);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<NetDiskPRJ.Model.Apscatcol> DataTableToList(DataTable dt)
        {
            DAL.Apscatcol ApscatcolDAL = new DAL.Apscatcol();
            List<NetDiskPRJ.Model.Apscatcol> modelList = new List<NetDiskPRJ.Model.Apscatcol>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                NetDiskPRJ.Model.Apscatcol model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = ApscatcolDAL.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return modelList;
        }

    }
}
